//
//  StringExtensions.swift
//  Fangxukanghan
//
//  Created by 常超群的MacBookPro on 2021/4/20.
//

import Foundation
import SwiftyJSON

public extension StringProtocol {
    func ccq_nsRange(of text: String) -> NSRange? { return range(of: text).map { NSRange($0, in: self) } }
}
public extension String {
    func ccq_toJSON() -> JSON? {
        if let data = self.data(using: .utf8) {
            if let json = try? JSON(data: data) {
                return json
            }
        }
        return nil
    }
}

